diff options
| author | MohamedBassem <me@mbassem.com> | 2024-09-14 13:26:50 +0100 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2024-09-14 13:26:50 +0100 |
| commit | b9c7857c5bb16d024fed6544eebf0ef6cd10390f (patch) | |
| tree | 7580a0f8d3d6a3a994297a5fbf232ab42cf9c2c8 /apps/mobile/app/dashboard/lists/[slug].tsx | |
| parent | 09e16babd4435e2ce82ff35dcec2c0a52717dc70 (diff) | |
| download | karakeep-b9c7857c5bb16d024fed6544eebf0ef6cd10390f.tar.zst | |
feature(mobile): Add proper error handling for server errors
Diffstat (limited to 'apps/mobile/app/dashboard/lists/[slug].tsx')
| -rw-r--r-- | apps/mobile/app/dashboard/lists/[slug].tsx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/apps/mobile/app/dashboard/lists/[slug].tsx b/apps/mobile/app/dashboard/lists/[slug].tsx index 10b9243d..72e3d0ae 100644 --- a/apps/mobile/app/dashboard/lists/[slug].tsx +++ b/apps/mobile/app/dashboard/lists/[slug].tsx @@ -2,6 +2,7 @@ import { Alert, Platform, View } from "react-native"; import * as Haptics from "expo-haptics"; import { router, Stack, useLocalSearchParams } from "expo-router"; import UpdatingBookmarkList from "@/components/bookmarks/UpdatingBookmarkList"; +import FullPageError from "@/components/FullPageError"; import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView"; import FullPageSpinner from "@/components/ui/FullPageSpinner"; import PageTitle from "@/components/ui/PageTitle"; @@ -14,7 +15,11 @@ export default function ListView() { if (typeof slug !== "string") { throw new Error("Unexpected param type"); } - const { data: list } = api.lists.get.useQuery({ listId: slug }); + const { + data: list, + error, + refetch, + } = api.lists.get.useQuery({ listId: slug }); return ( <CustomSafeAreaView> @@ -25,7 +30,9 @@ export default function ListView() { headerTransparent: true, }} /> - {list ? ( + {error ? ( + <FullPageError error={error.message} onRetry={() => refetch()} /> + ) : list ? ( <View> <UpdatingBookmarkList query={{ |
